package Tree;

/**
 * @Author zqc
 * @Date 2020/11/19-21:24
 * @Description 结点类：实现Comparable接口，重写compareTo方法，使之可排序
 */
public class Node implements Comparable<Node>{
    int val;
    Node left;
    Node right;

    public Node(int val){
        this.val = val;
    }

    @Override
    public int compareTo(Node o) {  //降序
        return -(this.val - o.val);
    }

    @Override
    public String toString() {
        return "Node{" +
                "val=" + val +
                ", left=" + left +
                ", right=" + right +
                '}';
    }
}
